<?php

namespace App\Rules;

use Illuminate\Contracts\Validation\Rule;
use CodeService;

/**
 * 验证码
 * @package App\Rules
 */
class CodeRule implements Rule
{
    protected $account;
    public function __construct($account)
    {
        $this->account = $account;
    }


    public function passes($attribute, $value)
    {
        return CodeService::check($this->account, $value);
    }


    public function message()
    {
        return '验证码输入错误';
    }
}
